/**
 * <pre>
 * ss-fire-collector / RandUtil.java
 * net.apexcns.core.util Class
 * RandUtil
 * <br>
 * 
 * <br>
 * @author ytjeong/apexcns,Inc.
 * @version 1.0
 * @see javadoc
 * @since 2012. 11. 14.
 * </pre>
 */
package com.ophelisis.common.util;

import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.Random;

/** <pre>
 * Class : net.apexcns.core.util.RandUtil / RandUtil.java
 * 	Define Class Object : 
 * <br>
 * </pre>
 * @author ytjeong / apexcns,Inc.
 * @version 1.0
 * @see javadoc
 * @since 2012. 11. 14.
 */

public class RandUtil {

    /** 통신방향 다중 배열 */
    public static final String[] COMM_DIRECT_ININ = new String[] { "1", "내부 -> 내부" };
    public static final String[] COMM_DIRECT_INOUT = new String[] { "2", "내부 -> 외부" };
    public static final String[] COMM_DIRECT_OUTIN = new String[] { "3", "외부 -> 내부" };
    public static final String[] COMM_DIRECT_OUTOUT = new String[] { "4", "외부 -> 외부" };
    public static final String[][] ARR_COMM_DIRECT_LIST = new String[][] { COMM_DIRECT_ININ, COMM_DIRECT_INOUT, COMM_DIRECT_OUTIN, COMM_DIRECT_OUTOUT };

    /** 상태값 다중 배열 */
    public static final String[] STATE_CODE_PASS = new String[] { "101", "Pass" };
    public static final String[] STATE_CODE_DELBLOC = new String[] { "104", "Delete/Block" };
    public static final String[] STATE_CODE_OTHER = new String[] { "999", "Other" };
    public static final String[][] ARR_STATE_CODE_LIST = new String[][] { STATE_CODE_PASS, STATE_CODE_DELBLOC, STATE_CODE_OTHER };

    /** 솔루션 구분 배열 */
    public static final String PROC_TYPE_ICMP = "ICMP";
    public static final String PROC_TYPE_TCP = "TCP";
    public static final String PROC_TYPE_UDP = "UDP";
    public static final String PROC_TYPE_P2P = "P2P";
    public static final String[] ARR_PROTOCOL_TYPE_LIST = new String[] { PROC_TYPE_ICMP, PROC_TYPE_TCP, PROC_TYPE_UDP, PROC_TYPE_P2P };
    
    /** 시그니처 구분 배열 */
    public static final String PROC_TYPE_ICMP_DESC = "ICMP: Host Sweep";
    public static final String PROC_TYPE_TCP_DESC = "TCP: Full-Connect Host Sweep";
    public static final String PROC_TYPE_UDP_DESC = "UDP: Host Sweep";
    public static final String PROC_TYPE_P2P_DESC = "P2P: BitTorrent Meta-Info Retrieving";
    public static final String[] ARR_PROTOCOL_TYPE_DESC_LIST = new String[] { PROC_TYPE_ICMP_DESC, PROC_TYPE_TCP_DESC, PROC_TYPE_UDP_DESC, PROC_TYPE_P2P_DESC };

    /** 도메인 구분 배열 */
    public static final String PROC_TYPE_ICMP_DOMAIN = "ICMP : IntruShield;AltId=5817022694592338918,AltType=Host Sweep,AttId=0x40009900,AttSig=N/A,AttConf=N/A,AdmDomain=My Company,IF=1A-1B,Cate=Reconnaissance(host-sweep),DetectMech=multi-flow-correlation,AppProto=N/A,Rele=Unknown;;;1";
    public static final String PROC_TYPE_TCP_DOMAIN = "TCP :  4-way handshake Detected;101;0;2;;;;;;IntruShield;AltId=5817022694592338922,AltType=Signature,AttId=0x00011300,AttSig=4_way_handshake,AttConf=Medium,AdmDomain=My Company,IF=1A-1B,Cate=PolicyViolation(restricted-access),DetectMech=signature,AppProto=N/A,Rele=Unknown;;;1";
    public static final String PROC_TYPE_UDP_DOMAIN = "UDP : Host Sweep;101;0;2;;;;;;IntruShield;AltId=5817022694592338932,AltType=Host Sweep,AttId=0x40017000,AttSig=N/A,AttConf=N/A,AdmDomain=My Company,IF=1A-1B,Cate=Reconnaissance(host-sweep),DetectMech=multi-flow-correlation,AppProto=N/A,Rele=Unknown;;;1";
    public static final String PROC_TYPE_P2P_DOMAIN = "P2P : BitTorrent Meta-Info Retrieving;104;0;2;;;;;;IntruShield;AltId=5817022694592338923,AltType=Signature,AttId=0x42c02000,AttSig=catch-most,AttConf=Low,AdmDomain=My Company,IF=1A-1B,Cate=PolicyViolation(restricted-application),DetectMech=signature,AppProto=N/A,Rele=Unknown;;;1";
    public static final String[] ARR_PROTOCOL_TYPE_DOMAIN_LIST = new String[] { PROC_TYPE_ICMP_DOMAIN, PROC_TYPE_TCP_DOMAIN, PROC_TYPE_UDP_DOMAIN, PROC_TYPE_P2P_DOMAIN };

    /** URL path(감염장소) 구분 배열 */
    public static final String URLPATH_CASE01 = "run.exe;N:\\storage\\RECYCLER\\S-1-5-21-3441485041-918478196-174860263-100";
    public static final String URLPATH_CASE02 = "C:\\Documents and Settings\\2728066\\Local Settings\\Temporary Inte";
    public static final String URLPATH_CASE03 = "C:\\Users\\KB1\\AppData\\Local\\Microsoft\\Windows\\Temporary Internet";
    public static final String[] ARR_URLPATH_CASE_LIST = new String[] { URLPATH_CASE01, URLPATH_CASE02, URLPATH_CASE03 };

    /** 바이러스 명 구분 배열 */
    public static final String VIRUSNAME_CASE01 = "Win-Trojan/Autorun.100352";
    public static final String VIRUSNAME_CASE02 = "TextImage/Autorun";
    public static final String[] ARR_VIRUSNAME_CASE_LIST = new String[] { VIRUSNAME_CASE01, VIRUSNAME_CASE02 };

    /** 바이러스 상태 구분 배열 */
    public static final String VIRUSSTATUS_CASE01 = "<STATUS=삭제>";
    public static final String VIRUSSTATUS_CASE02 = "<STATUS=차단>";
    public static final String[] ARR_VIRUSSTATUS_CASE_LIST = new String[] { VIRUSSTATUS_CASE01, VIRUSSTATUS_CASE02 };

    /** 공란(SCANTYPE) 구분 배열 */
    public static final String SCANTYPE_CASE01 = "<SCANTYPE=메신저 감시>";
    public static final String SCANTYPE_CASE02 = "<SCANTYPE=메신저 차단>";
    public static final String[] ARR_SCANTYPE_CASE_LIST = new String[] { SCANTYPE_CASE01, SCANTYPE_CASE02 };

    /** 컴퓨터이름,상태,부서 구분 배열 */
    public static final String COMUSER_CASE01 = "<USERNAME=OLDSTORAGE:영업점/대기업/기관영업/여의도법인영업부>";
    public static final String COMUSER_CASE02 = "<COMNAME=T3377-10Y><USERNAME=유성상:본부/대출실행센터>";
    public static final String COMUSER_CASE03 = "<COMNAME=황년혜_예비><USERNAME=황년혜_예비:영업점/여의도본점";
    public static final String COMUSER_CASE04 = "<COMNAME=KB1-PC><USERNAME=KB1-PC:본부/기타>";
    public static final String[] ARR_COMUSER_CASE_LIST = new String[] { COMUSER_CASE01, COMUSER_CASE02, COMUSER_CASE03, COMUSER_CASE04 };

    /** Webkepper wg 구분 배열 */
    public static final String WEBKEEPER_WG_CASE01 = "WOR";
    public static final String WEBKEEPER_WG_CASE02 = "S";
    public static final String[] ARR_WEBKEEPER_WG_CASE_LIST = new String[] { WEBKEEPER_WG_CASE01, WEBKEEPER_WG_CASE02 };

    /** URI TYPE(GET, POST, ... 구분 배열 */
    public static final String URI_TYPE_CASE01 = "GET";
    public static final String URI_TYPE_CASE02 = "POST";
    public static final String[] ARR_URI_TYPE_CASE_LIST = new String[] { URI_TYPE_CASE01, URI_TYPE_CASE02 };

    /** DBLog id TYPE 구분 배열 */
    public static final String DB_ID_TYPE_CASE01 = "root";
    public static final String DB_ID_TYPE_CASE02 = "system";
    public static final String[] ARR_DB_ID_TYPE_CASE_LIST = new String[] { DB_ID_TYPE_CASE01, DB_ID_TYPE_CASE02 };

    /** DBLog PID 값 구분 배열 */
    public static final String DB_PID_CASE01 = "4886570";
    public static final String DB_PID_CASE02 = "3649770";
    public static final String DB_PID_CASE03 = "4477158";
    public static final String DB_PID_CASE04 = "4276250";
    public static final String DB_PID_CASE05 = "4943872";
    public static final String DB_PID_CASE06 = "5140592";
    public static final String DB_PID_CASE07 = "3916004";
    public static final String[] ARR_DB_PID_CASE_LIST = new String[] { DB_PID_CASE01, DB_PID_CASE02, DB_PID_CASE03, DB_PID_CASE04, DB_PID_CASE05, DB_PID_CASE06, DB_PID_CASE07 };

    /** DBLog 경로(PATH) 값 구분 배열 */
    public static final String DB_PATH_CASE01 = "/usr/lpp/diagnostics/bin/run_ssa_healthcheck 1>/dev/null 2>/dev/null";
    public static final String DB_PATH_CASE02 = "/usr/lpp/diagnostics/bin/run_ssa_encl_healthcheck 1";
    public static final String DB_PATH_CASE03 = "/usr/lpp/diagnostics/bin/run_ssa_encl_healthcheck 1>/dev/null 2>/dev/null";
    public static final String DB_PATH_CASE04 = "su - oracle -c /oradata/backup/GONGSI/script/GONGSI_BACKUP.sh";
    public static final String DB_PATH_CASE05 = "/usr/esa/sbin/esa_awareness";
    public static final String[] ARR_DB_PATH_CASE_LIST = new String[] { DB_PATH_CASE01, DB_PATH_CASE02, DB_PATH_CASE03, DB_PATH_CASE04, DB_PATH_CASE05 };

    /** DBLog PID & Message 값 구분 배열 */
    public static final String DB_PID_MSG_CASE01 = "Successful";
    public static final String DB_PID_MSG_CASE02 = "Failed";
    public static final String[] ARR_DB_PID_MSG_CASE_LIST = new String[] { DB_PID_MSG_CASE01, DB_PID_MSG_CASE02 };

    /** Apache URL 경로 값 구분 배열 */
    public static final String AP_URL_PATH_CASE01 = "/html/images/school/bu_detail_2012_over.gif HTTP";
    public static final String AP_URL_PATH_CASE02 = "/schoolAction.do?process=schoolDisclose001&schoolCd=73061000&orgcode=1&sry_yy=2010&selectYear=2010&univ_gubun=C&detail_kind=C";
    public static final String AP_URL_PATH_CASE03 = "/chart/Column2D3/Column2Data.jsp?";
    public static final String[] ARR_AP_URL_PATH_CASE_LIST = new String[] { AP_URL_PATH_CASE01, AP_URL_PATH_CASE02, AP_URL_PATH_CASE03 };

    /** Apache http 버전 값 구분 배열 */
    public static final String AP_HTTP_VERSION_CASE01 = "HTTP/1.1";
    public static final String AP_HTTP_VERSION_CASE02 = "HTTP/1.1";
    public static final String[] ARR_AP_HTTP_VERSION_CASE_LIST = new String[] { AP_HTTP_VERSION_CASE01, AP_HTTP_VERSION_CASE02 };

    /** Apache http response 값 구분 배열 */
    public static final String AP_HTTP_RESPONSE_CODE_CASE01 = "200";
    public static final String AP_HTTP_RESPONSE_CODE_CASE02 = "304";
    public static final String[] ARR_AP_HTTP_RESPONSE_CODE_CASE_LIST = new String[] { AP_HTTP_RESPONSE_CODE_CASE01, AP_HTTP_RESPONSE_CODE_CASE02 };


    /** VPN ID 값 구분 배열 */
    public static final String VPN_ID_CASE01 = "DK95077";
    public static final String VPN_ID_CASE02 = "DS27041";
    public static final String VPN_ID_CASE03 = "50322";
    public static final String VPN_ID_CASE04 = "SG030501";
    public static final String VPN_ID_CASE05 = "SG050611";
    public static final String[] ARR_VPN_ID_CASE_LIST = new String[] { VPN_ID_CASE01, VPN_ID_CASE02, VPN_ID_CASE03, VPN_ID_CASE04, VPN_ID_CASE05 };
    
    /** <pre>
     * Method : RandUtil.main()
     * 
     * <br>
     * 	return type of void
     * <br>
     * @param args 
     * </pre>
     */
    public static void main(String args[]) {
	
	RandUtil ru = new RandUtil();
	
//	ru.testRandNum();
//	
//	ru.testStringFormat(); 
//	
//	ru.testRandIP();
	
//	ru.testStringCode();
	
//	ru.testProcessingTime();
	System.out.println(ru.randNum(2));
	System.out.println(ru.randNum(2));
	System.out.println(ru.randNum(2));
	System.out.println(ru.randNum(2));
	System.out.println(ru.randNum(2));
    }
    
    public static void test(String args[]) {

	    Random oRandom = new Random();

	    // Random 클래스 없이 0.0 ~ 1.0 사이의 실수 난수 구하기
	    for (int i = 1; i <= 1; i++)
	      System.out.println(Math.random());
	    
	    System.out.println();  // 줄바꿈

	    // 1~10까지의 정수를 랜덤하게 출력
	    int i = oRandom.nextInt(10) + 1;
	    System.out.println(i);

	    System.out.println();  // 줄바꿈

	    // 0.0f 에서 1.0f 까지의 실수를 랜덤하게 출력
	    // 3.7670135E-5 라는 값이 나올 수도 있는데 이것은
	    // 0.000037670135 입니다.
	    float f = oRandom.nextFloat();
	    System.out.println(f);

	    System.out.println();  // 줄바꿈
	    
	    // true(참), false(거짓) 중의 하나를 랜덤하게 출력
	    Boolean b = oRandom.nextBoolean();
	    System.out.println(b);

	    System.out.println();  // 줄바꿈

	    // 분포가 가운데에서 종 모양을 이루는 가우시안 랜덤 실수 1000개 출력
	    // 평균 0.0 표준편차 1.0의 Gauss(가우스) 분포의 double형 난수 생성

	    for (int i2 = 1; i2 <= 1; i2++)
	      System.out.println(oRandom.nextGaussian());

	    System.out.println();  // 줄바꿈

	    // 이것은 0.0 ~ 1.0 까지 균일한 분포로 랜덤한 실수 1000개 만들기 예제
	    for (int i3 = 1; i3 <= 1; i3++)
	       System.out.println(oRandom.nextDouble());
	    
	    System.out.println();  // 줄바꿈
	    
	    // 대문자 A-Z 랜덤 알파벳 생성
	    for (int i4 = 1; i4 <= 5; i4++) {
	      char ch = (char) ((Math.random() * 26) + 65);
	      System.out.print(ch + " ");
	    }

	    System.out.println();  // 줄바꿈

	    // 소문자 a-z 랜덤 알파벳 생성
	    for (int i5 = 1; i5 <= 5; i5++) {
	      char ch = (char) ((Math.random() * 26) + 97);
	      System.out.print(ch + " ");
	    }

	    System.out.println();  // 줄바꿈
	    
	    
	    
	    
	    
	  }  
    
    public void testRandNum() {
	int pos=3;
	int max=255;
	
	System.out.println( "test] randNum("+ max+") ====> " + randNum(max) );
	System.out.println();  // 줄바꿈
	
	System.out.println( "test] randNumStr("+pos + ", " + max+") ====> " + randNumStr(pos, max) );
	System.out.println( "test] randNumStr(0"+ ", " + max+") ====> " + randNumStr(0, max) );
	System.out.println();  // 줄바꿈
	
	System.out.println( "test] randStr("+pos+") ====> " + randStr(pos) );
	System.out.println( "test] randLowerStr("+pos+") ====> " + randLowerStr(pos) );
	System.out.println( "test] randUpperStr("+pos+") ====> " + randUpperStr(pos) );
	System.out.println();  // 줄바꿈
    }
    
    public void testRandIP() {
	String ipAddressVar = "172.17.186.#{RAND_NUM(3, 255)}";
	System.out.println( "test] getFuncVar("+ipAddressVar+") ====> " + getFuncVar(ipAddressVar) );
	System.out.println( "test] getFuncName("+ipAddressVar+") ====> " + getFuncName(ipAddressVar) );
	System.out.println();  // 줄바꿈
	
	ipAddressVar = "#{RAND_NUM(3, 255)} aaa";
	System.out.println( "test] getFuncVar("+ipAddressVar+") ====> " + getFuncVar(ipAddressVar) );
	System.out.println( "test] getFuncName("+ipAddressVar+") ====> " + getFuncName(ipAddressVar) );
	System.out.println();  // 줄바꿈

	ipAddressVar = "{RAND_NUM(3, 255)} aaa";
	System.out.println( "test] getFuncVar("+ipAddressVar+") ====> " + getFuncVar(ipAddressVar) );
	System.out.println( "test] getFuncName("+ipAddressVar+") ====> " + getFuncName(ipAddressVar) );
	System.out.println();  // 줄바꿈

	ipAddressVar = "#{RAND_NUM(3, 255) aaa";
	System.out.println( "test] getFuncVar("+ipAddressVar+") ====> " + getFuncVar(ipAddressVar) );
	System.out.println( "test] getFuncName("+ipAddressVar+") ====> " + getFuncName(ipAddressVar) );
	System.out.println();  // 줄바꿈

	ipAddressVar = "124.3.#{RAND_NUM(3, 255)}.#{RAND_NUM(3, 255)}"; // 현재는 앞선 하나 만 처리함.
	System.out.println( "test] getFuncVar("+ipAddressVar+") ====> " + getFuncVar(ipAddressVar) );
	System.out.println( "test] getFuncName("+ipAddressVar+") ====> " + getFuncName(ipAddressVar) );
	System.out.println();  // 줄바꿈
	
	//둘 이상의 처리를 위한 Logic
	ipAddressVar = "124.3.#{RAND_NUM(3, 255)}.#{RAND_NUM(3, 255)}"; // 현재는 앞선 하나 만 처리함.
	
	
	System.out.println( "test] getFuncVar("+ipAddressVar+") ====> " + getFuncVar(ipAddressVar) );
	System.out.println( "test] getFuncName("+ipAddressVar+") ====> " + getFuncName(ipAddressVar) );
	System.out.println();  // 줄바꿈
	
	//ipAddressVar.indexOf(str, fromIndex);
    }
    public void testStringCode() {

	System.out.println( "test] randCodeStr("+StringUtil.desplitStr(ARR_PROTOCOL_TYPE_LIST, ',')+") ====> " + randCodeStr(ARR_PROTOCOL_TYPE_LIST) );
	System.out.println();  // 줄바꿈

	System.out.println( "test] randCodeStr("+StringUtil.desplitStr(ARR_PROTOCOL_TYPE_DESC_LIST, ',')+") ====> " + randCodeStr(ARR_PROTOCOL_TYPE_DESC_LIST) );
	System.out.println();  // 줄바꿈
	
	System.out.println( "test] randCodeStr("+StringUtil.desplitStr(ARR_STATE_CODE_LIST, ',')+") ====> " + randCodeStr(ARR_STATE_CODE_LIST, 0) );
	System.out.println( "test] randCodeStr("+StringUtil.desplitStr(ARR_STATE_CODE_LIST, ',')+") ====> " + randCodeStr(ARR_STATE_CODE_LIST, 1) );
	//System.out.println( "test] randCodeStr("+StringUtil.desplitStr(ARR_STATE_CODE_LIST, 1, ',')+") ====> " + randCodeStr(ARR_STATE_CODE_LIST, 0) );
	//System.out.println( "test] randCodeStr("+StringUtil.desplitStr(ARR_STATE_CODE_LIST, 0, ',')+") ====> " + randCodeStr(ARR_STATE_CODE_LIST, 1) );
	System.out.println();  // 줄바꿈
	
	// ARR_COMM_DIRECT_LIST
	System.out.println( "test] randCodeStr("+StringUtil.desplitStr(ARR_COMM_DIRECT_LIST, ',')+") ====> " + randCodeStr(ARR_COMM_DIRECT_LIST, 0) );
	System.out.println( "test] randCodeStr("+StringUtil.desplitStr(ARR_COMM_DIRECT_LIST, ',')+") ====> " + randCodeStr(ARR_COMM_DIRECT_LIST, 1) );
	System.out.println();  // 줄바꿈
	
	// ARR_COMM_DIRECT_LIST
	System.out.println( "test] randCodeStr("+StringUtil.desplitStr(ARR_URLPATH_CASE_LIST, ',')+") ====> " + randCodeStr(ARR_URLPATH_CASE_LIST) );
	//ARR_VIRUSNAME_CASE_LIST
	System.out.println( "test] randCodeStr("+StringUtil.desplitStr(ARR_VIRUSNAME_CASE_LIST, ',')+") ====> " + randCodeStr(ARR_VIRUSNAME_CASE_LIST) );
	//ARR_VIRUSSTATUS_CASE_LIST
	System.out.println( "test] randCodeStr("+StringUtil.desplitStr(ARR_VIRUSSTATUS_CASE_LIST, ',')+") ====> " + randCodeStr(ARR_VIRUSSTATUS_CASE_LIST) );
	//ARR_SCANTYPE_CASE_LIST
	System.out.println( "test] randCodeStr("+StringUtil.desplitStr(ARR_SCANTYPE_CASE_LIST, ',')+") ====> " + randCodeStr(ARR_SCANTYPE_CASE_LIST) );
	//ARR_COMUSER_CASE_LIST
	System.out.println( "test] randCodeStr("+StringUtil.desplitStr(ARR_COMUSER_CASE_LIST, ',')+") ====> " + randCodeStr(ARR_COMUSER_CASE_LIST) );
	System.out.println();  // 줄바꿈
	
//	    ARR_WEBKEEPER_WG_CASE_LIST
	System.out.println( "test] randCodeStr("+StringUtil.desplitStr(ARR_WEBKEEPER_WG_CASE_LIST, ',')+") ====> " + randCodeStr(ARR_WEBKEEPER_WG_CASE_LIST) );
//	    ARR_URI_TYPE_CASE_LIST
	System.out.println( "test] randCodeStr("+StringUtil.desplitStr(ARR_URI_TYPE_CASE_LIST, ',')+") ====> " + randCodeStr(ARR_URI_TYPE_CASE_LIST) );
//	    ARR_DB_ID_TYPE_CASE_LIST
	System.out.println( "test] randCodeStr("+StringUtil.desplitStr(ARR_DB_ID_TYPE_CASE_LIST, ',')+") ====> " + randCodeStr(ARR_DB_ID_TYPE_CASE_LIST) );
//	    ARR_DB_PID_CASE_LIST
	System.out.println( "test] randCodeStr("+StringUtil.desplitStr(ARR_DB_PID_CASE_LIST, ',')+") ====> " + randCodeStr(ARR_DB_PID_CASE_LIST) );
//	    ARR_DB_PATH_CASE_LIST
	System.out.println( "test] randCodeStr("+StringUtil.desplitStr(ARR_DB_PATH_CASE_LIST, ',')+") ====> " + randCodeStr(ARR_DB_PATH_CASE_LIST) );
//	    ARR_DB_PID_MSG_CASE_LIST
	System.out.println( "test] randCodeStr("+StringUtil.desplitStr(ARR_DB_PID_MSG_CASE_LIST, ',')+") ====> " + randCodeStr(ARR_DB_PID_MSG_CASE_LIST) );
//	    ARR_AP_URL_PATH_CASE_LIST
	System.out.println( "test] randCodeStr("+StringUtil.desplitStr(ARR_AP_URL_PATH_CASE_LIST, ',')+") ====> " + randCodeStr(ARR_AP_URL_PATH_CASE_LIST) );
//	    ARR_AP_HTTP_VERSION_CASE_LIST
	System.out.println( "test] randCodeStr("+StringUtil.desplitStr(ARR_AP_HTTP_VERSION_CASE_LIST, ',')+") ====> " + randCodeStr(ARR_AP_HTTP_VERSION_CASE_LIST) );
//	    ARR_AP_HTTP_RESPONSE_CODE_CASE_LIST
	System.out.println( "test] randCodeStr("+StringUtil.desplitStr(ARR_AP_HTTP_RESPONSE_CODE_CASE_LIST, ',')+") ====> " + randCodeStr(ARR_AP_HTTP_RESPONSE_CODE_CASE_LIST) );
//	    ARR_VPN_ID_CASE_LIST
	System.out.println( "test] randCodeStr("+StringUtil.desplitStr(ARR_VPN_ID_CASE_LIST, ',')+") ====> " + randCodeStr(ARR_VPN_ID_CASE_LIST) );
	System.out.println();  // 줄바꿈

    }
    public void testStringFormat() {

	System.out.println();  // 줄바꿈
	
	//% [인자 번호] [플래그] [너비] [.정밀도] 유형
	//%d 십진정수, %f 부동소수점, %x 16진수, %c 문자

	//%tc 날짜와 시간 전부 표시
	//%tr 시간만 표시할때
	//%A %B %C 요일,월,일 표시

	String s = String.format("%, d", 1000000000);
	System.out.println(s);
	String fo = String.format("I have %.2f bugs to fix.", 44444.444);
	System.out.println(fo);
	String fo1 = String.format("I have %,.2f bugs to fix ", 2231323.23132);
	System.out.println(fo1);
	String fo2 = String.format("%,6.1f", 1323131123.133123213);
	System.out.println(fo2);
	String fo3 = String.format("%tc", new Date() );
	System.out.println(fo3);
	String fo4 = String.format("%tr", new Date() );
	System.out.println(fo4);
	String fo5 = String.format("%tA %tB %tC", new Date(), new Date(), new Date() );
	System.out.println(fo5);
	// 인자 하나로 
	String fo6 = String.format("%tA %<tB %<tC", new Date() );
	System.out.println(fo6);

	System.out.println();  // 줄바꿈
    }
    
    public void testProcessingTime() {

	System.out.println();  // 줄바꿈
	getProcessingTime();
    }
    // TODO::다중 변수 처리
    // TODO::정규표현식에 의한 Pattern 처리
    // http://ra2kstar.tistory.com/119
    // http://pupustory.tistory.com/132
    // http://easymicro.egloos.com/5461610
    
    // TODO::날짜처리
    // http://dolly217.tistory.com/40
//    - 처리시간  (20121015 015959)
//    - 수집시간  (20121125 240000)
//    - (13/Jul/2012:17:41:10 +0900)
//    - (01/Nov/2012:00:00:00 +0900)
//    - (12/Jul/2012:17:41:24)
//    - (Sat Jul 11 00:00:00 2012)
//    - (Mar  7 08:00:01)
    
    
    
    public String getProcessingTime() {
	String res = "";
	
//	// 밀리초 단위(*1000은 1초), 음수이면 이전 시각 "1352892555785"
//	long time = System.currentTimeMillis(); 
//	System.out.println ( "밀리초 단위::" +  Long.valueOf(time).toString() ); 
//	
//	//현재 시각을 가져오기. "Wed Nov 14 20:29:15 KST 2012"
//	Date today = new Date (); 
//	System.out.println ( "Date today::" +  today );
//	
//	// 날짜(년/월/일/시/분/초) 구하기
//	SimpleDateFormat formatter = new SimpleDateFormat ( "yyyy.MM.dd HH:mm:ss", Locale.KOREA );
//	Date currentTime = new Date ( );
//	String dTime = formatter.format ( currentTime );
//	System.out.println ( "Date 날짜(년/월/일/시/분/초)::" +  dTime );
//	
//	// 날짜(년/월/일/시/분/초) 구하기2
//	GregorianCalendar gctoday = new GregorianCalendar();
//
//	int year = gctoday.get ( gctoday.YEAR );
//	int month = gctoday.get ( gctoday.MONTH ) + 1;
//	int yoil = gctoday.get ( gctoday.DAY_OF_MONTH ); 
//
//	GregorianCalendar gc = new GregorianCalendar ( );
//
//	System.out.println ( "Date YEAR ::" +  gc.get ( Calendar.YEAR ) );
//	System.out.println ( "Date MONTH::" +  String.valueOf ( gc.get ( Calendar.MONTH ) + 1 ) );
//	System.out.println ( "Date DAY::" +  gc.get ( Calendar.DATE ) );
//	System.out.println ( "Date DAY OF MONTH::" +  gc.get ( Calendar.DAY_OF_MONTH ) );
//
//	// 날짜(년/월/일/시/분/초) 구하기3
//	DateFormat df = DateFormat.getDateInstance(DateFormat.LONG, Locale.KOREA);
//	Calendar cal = Calendar.getInstance(Locale.KOREA);
//	String nal = df.format(cal.getTime());
//	System.out.println ( "Date 날짜(년/월/일/시/분/초)::" +  nal );
//	
//	// "Sun, 5 Dec 1999 00:07:21"를 "1999-12-05"로 바꾸기
//	// http://7654.tistory.com/128
//	SimpleDateFormat formatter_one = new SimpleDateFormat ( "EEE, dd MMM yyyy hh:mm:ss",Locale.ENGLISH );
//	SimpleDateFormat formatter_two = new SimpleDateFormat ( "yyyy-MM-dd" );
//
//	String inString = "Sun, 5 Dec 1999 00:07:21"; 
//
//	ParsePosition pos = new ParsePosition ( 0 );
//	Date frmTime = formatter_one.parse ( inString, pos );
//	String outString = formatter_two.format ( frmTime );
//
//	System.out.println ( "Date inString ::" +  outString );
//	
////	    - 처리시간  (20121015 015959)
////	    - 수집시간  (20121125 240000)
////	    - (13/Jul/2012:17:41:10 +0900)
////	    - (01/Nov/2012:00:00:00 +0900)
////	    - (12/Jul/2012:17:41:24)
////	    - (Sat Jul 11 00:00:00 2012)
////	    - (Mar  7 08:00:01)
//
//	// 날짜(년/월/일/시/분/초) 구하기
//	String dsTime = getCurrentDate("yyyy.MM.dd HH:mm:ss", Locale.KOREA);
//	System.out.println ( "Date 날짜(년/월/일/시/분/초)::" +  dsTime );
//	
//	dsTime = getCurrentDate("yyyyMMdd HHmmss", Locale.KOREA);
//	System.out.println ( "Date 날짜(20121015 015959)::" +  dsTime );
//	
//	dsTime = getCurrentDate("dd/MMM/yyyy:HH:mm:ss Z z", Locale.ENGLISH);
//	System.out.println ( "Date 날짜(13/Jul/2012:17:41:10 +0900)::" +  dsTime );
//	
//	SimpleDateFormat fmtLastModified = new SimpleDateFormat("dd/MMM/yyyy:HH:mm:ss +0900 Z z", Locale.ENGLISH);
//	fmtLastModified.setTimeZone(TimeZone.getTimeZone("GMT"));
//	dsTime = fmtLastModified.format ( currentTime );
//	System.out.println ( "Date 날짜(13/Jul/2012:17:41:10 +0900)::" +  dsTime );
//	
//	fmtLastModified = new SimpleDateFormat("dd/MMM/yyyy:HH:mm:ss +0900 Z z", Locale.ENGLISH);
//	fmtLastModified.setTimeZone(TimeZone.getTimeZone("KST"));
//	dsTime = fmtLastModified.format ( currentTime );
//	System.out.println ( "Date 날짜(13/Jul/2012:17:41:10 +0900)::" +  dsTime );
//	
//	
//	
//	
//	dsTime = getCurrentDate("dd/MMM/yyyy:HH:mm:ss", Locale.ENGLISH);
//	System.out.println ( "Date 날짜(12/Jul/2012:17:41:24)::" +  dsTime );
//	
//	dsTime = getCurrentDate("EEE MMM dd HH:mm:ss yyyy", Locale.ENGLISH);
//	System.out.println ( "Date 날짜(Sat Jul 11 00:00:00 2012)::" +  dsTime );
//	
//	dsTime = getCurrentDate("MMM d HH:mm:ss", Locale.ENGLISH);
//	System.out.println ( "Date 날짜(Mar  7 08:00:01)::" +  dsTime );
//	
//	
//	dsTime = getCurrentDate("MMM d HH:mm:ss Z z", Locale.KOREA);
//	System.out.println ( "Date 날짜(Mar  7 08:00:01)::" +  dsTime );
//	
//	System.out.println();  // 줄바꿈
//
//	String frDateStr1 = "20121101120000";
//	String toDateStr1 = "20121101120001";
//	try {
//	    Date sebelum = new SimpleDateFormat("dd MM yyyy").parse("01 11 2012");
//	    sebelum = new SimpleDateFormat("yyyyMMddHHmmss").parse(frDateStr1);
//	    Date sesudah = new SimpleDateFormat("dd MM yyyy").parse("20 11 2012");
//	    sesudah = new SimpleDateFormat("yyyyMMddHHmmss").parse(toDateStr1);
//	    for (int i = 0; i < 5; i++) {
//		System.out.println("Repeat " + i + ">" + getDate(getRandomDateBetween(sebelum, sesudah), "yyyyMMdd HHmmss", Locale.KOREA));
//	    }
//	    System.out.println();  // 줄바꿈
//	    for (int i = 0; i < 5; i++) {
//		System.out.println("Repeat " + i + ">" + getDate(getRandomDateBetween(sebelum, sesudah), "dd/MMM/yyyy:HH:mm:ss Z z", Locale.ENGLISH));
//	    }
//	    System.out.println();  // 줄바꿈
//	    for (int i = 0; i < 5; i++) {
//		System.out.println("Repeat " + i + ">" + getDate(getRandomDateBetween(sebelum, sesudah), "dd/MMM/yyyy:HH:mm:ss", Locale.ENGLISH));
//	    }
//	    System.out.println();  // 줄바꿈
//	    for (int i = 0; i < 5; i++) {
//		System.out.println("Repeat " + i + ">" + getDate(getRandomDateBetween(sebelum, sesudah), "EEE MMM dd HH:mm:ss yyyy", Locale.ENGLISH));
//	    }
//	    System.out.println();  // 줄바꿈
//	    for (int i = 0; i < 5; i++) {
//		System.out.println("Repeat " + i + ">" + getDate(getRandomDateBetween(sebelum, sesudah), "MMM d HH:mm:ss", Locale.ENGLISH));
//	    }
//	    System.out.println();  // 줄바꿈
//	} catch (ParseException e) {
//	    // TODO Auto-generated catch block
//	    e.printStackTrace();
//	} 
	
	String frDateStr = "20121116000000";
	String toDateStr = "20121117235959";
	for (int i = 0; i < 3; i++) {
	    System.out.println("test] randDateStr("+frDateStr+", "+toDateStr+") Repeat " + i + " ====> " + randDateStr(frDateStr, toDateStr) );
	    }
	System.out.println();  // 줄바꿈
	for (int i = 0; i < 3; i++) {
	    System.out.println("test] randDateStrWebAccessTime("+frDateStr+", "+toDateStr+") Repeat " + i + " ====> " + randDateStrWebAccessTime(frDateStr, toDateStr) );
	    }
	System.out.println();  // 줄바꿈
	for (int i = 0; i < 3; i++) {
	    System.out.println("test] randDateStrWasErrorTime("+frDateStr+", "+toDateStr+") Repeat " + i + " ====> " + randDateStrWasErrorTime(frDateStr, toDateStr) );
	    }
	System.out.println();  // 줄바꿈
	for (int i = 0; i < 3; i++) {
	    System.out.println("test] randDateStrDBLogTime("+frDateStr+", "+toDateStr+") Repeat " + i + " ====> " + randDateStrDBLogTime(frDateStr, toDateStr) );
	    }
	System.out.println();  // 줄바꿈
	for (int i = 0; i < 3; i++) {
	    System.out.println("test] randDateStrOther("+frDateStr+", "+toDateStr+") Repeat " + i + " ====> " + randDateStrOther(frDateStr, toDateStr) );
	    }
	System.out.println();  // 줄바꿈
	for (int i = 0; i < 3; i++) {
	    System.out.println("test] randDateStrVPNDayTime("+frDateStr+", "+toDateStr+") Repeat " + i + " ====> " + randDateStrVPNDayTime(frDateStr, toDateStr) );
	    }
	System.out.println();  // 줄바꿈
	for (int i = 0; i < 3; i++) {
	    System.out.println("test] randDateStrVPNDay("+frDateStr+", "+toDateStr+") Repeat " + i + " ====> " + randDateStrVPNDay(frDateStr, toDateStr) );
	    }
	System.out.println();  // 줄바꿈
	for (int i = 0; i < 3; i++) {
	    System.out.println("test] randDateStrVPNTime("+frDateStr+", "+toDateStr+") Repeat " + i + " ====> " + randDateStrVPNTime(frDateStr, toDateStr) );
	    }
	System.out.println();  // 줄바꿈
	
	//System.out.println("getFuncName[stidx:"+stidx + ", edidx:" + edidx+"] [" + fn + "] ==> " + res);
	return res;
    }
    
//    - 처리시간  (20121015 015959)
//  - 수집시간  (20121125 240000)
    public String randDateStr(String from, String to) {
	String formatOutDate = "yyyyMMdd HHmmss";
	return randDateStr(from, to, formatOutDate);
    }
//    - (13/Jul/2012:17:41:10 +0900)	==> Web_Access / Apache Access Time
//  - (01/Nov/2012:00:00:00 +0900)	==> Web_Access / Apache Access  Time
    public String randDateStrWebAccessTime(String from, String to) {
	String formatOutDate = "dd/MMM/yyyy:HH:mm:ss Z";
	return randDateStr(from, to, formatOutDate);
    }
    
    public String randDateStrWebAccessTime2(String from, String to) {
	String formatOutDate = "dd/MMM/yyyy:HH:mm:ss Z";
	return randDateStr(from, to, formatOutDate);
    }
	
//    - (12/Jul/2012:17:41:24)	==> Was_Error Time
    public String randDateStrWasErrorTime(String from, String to) {
	String formatOutDate = "dd/MMM/yyyy:HH:mm:ss";
	return randDateStr(from, to, formatOutDate);
    }
//    - (Sat Jul 11 00:00:00 2012)	==> DBLog Time
    public String randDateStrDBLogTime(String from, String to) {
	String formatOutDate = "EEE MMM dd HH:mm:ss yyyy";
	return randDateStr(from, to, formatOutDate);
    }
//    - (Mar  7 08:00:01)
    public String randDateStrOther(String from, String to) {
	String formatOutDate = "MMM d HH:mm:ss";
	return randDateStr(from, to, formatOutDate);
    }
//  - (07-Mar 08:00:01)
    public String randDateStrVPNDayTime(String from, String to) {
	String formatOutDate = "dd-MMM HH:mm:ss";
	return randDateStr(from, to, formatOutDate);
    }
//  - (07-Mar)
    public String randDateStrVPNDay(String from, String to) {
	String formatOutDate = "dd-MMM";
	return randDateStr(from, to, formatOutDate);
    }
//  - (08:00:01)
    public String randDateStrVPNTime(String from, String to) {
	String formatOutDate = "HH:mm:ss";
	return randDateStr(from, to, formatOutDate);
    }
    
    // 지정 formatOutDate 형식에 맞추어 from 에서 to 사이의 Date String을 랜덤하게 발생
    public String randDateStr(String from, String to, String formatOutDate) {
	Locale loc = Locale.ENGLISH;
	
	return randDateStr(from, to, formatOutDate, loc);
    }
    
    // 지정 formatOutDate 형식에 맞추어 from 에서 to 사이의 Date String을 랜덤하게 발생
    public String randDateStr(String from, String to, String formatOutDate, Locale loc) {
	Date sebelum = null;
	Date sesudah = null;
	String formatInDate = "yyyyMMddHHmmss";	// 고정
	//String formatOutDate = "yyyyMMdd HHmmss";
	
	try {
	    sebelum = new SimpleDateFormat(formatInDate).parse(from);
	    sesudah = new SimpleDateFormat(formatInDate).parse(to);
	} catch (ParseException e) {
	    return "";
	} 
	return getDate(getRandomDateBetween(sebelum, sesudah), formatOutDate, loc);
    }
    
    // from 에서 to 사이의 Date를 랜덤하게 발생
    private Date getRandomDateBetween(Date from, Date to) {
	Calendar cal = Calendar.getInstance();

	cal.setTime(from);
	BigDecimal decFrom = new BigDecimal(cal.getTimeInMillis());
	
	cal.setTime(to);
	BigDecimal decTo = new BigDecimal(cal.getTimeInMillis());
	
	BigDecimal selisih = decTo.subtract(decFrom).add(new BigDecimal(1000));	// 최종 To까지 포함하기 위해
	BigDecimal factor = selisih.multiply(new BigDecimal(Math.random()));
	
	return new Date((factor.add(decFrom)).longValue());
    }
    
	/**
	 * 현재의 날짜를 포멧에 맞게 변환 해준다.
	 * 
	 * <pre>
	 * SimpleDateFormat Format Syntax
	 * G        era designator          (Text)              AD
	 * y        year                    (Number)            1996
	 * M        month in year           (Text & Number)     July & 07
	 * d        day in month            (Number)            10
	 * h        hour in am/pm (1~12)    (Number)            12
	 * H        hour in day (0~23)      (Number)            0
	 * m        minute in hour          (Number)            30
	 * s        second in minute        (Number)            55
	 * S        millisecond             (Number)            978
	 * E        day in week             (Text)              Tuesday
	 * D        day in year             (Number)            189
	 * F        day of week in month    (Number)            2 (2nd Wed in July)
	 * w        week in year            (Number)            27
	 * W        week in month           (Number)            2
	 * a        am/pm marker            (Text)              PM
	 * k        hour in day (1~24)      (Number)            24
	 * K        hour in am/pm (0~11)    (Number)            0
	 * z        time zone               (Text)              Pacific Standard Time
	 * '        escape for text         (Delimiter)
	 * ''       single quote            (Literal)           '
	 * </pre>
	 * 
	 * 예) WUtil.getCurrentDate("yyyy년 MM월 dd일") WUtil.getSvcLang("KR",
	 * WUtil.getCurrentDate("yyyy년 MM월 dd일"),
	 * WUtil.getCurrentDate("MM dd, yyyy")) WUtil.getCurrentFullDate("KR")
	 * 
	 * @param format
	 * @param loc
	 * @return
	 */
	public static String getCurrentDate(String format, Locale loc) {
		if (format == null || format.equals(""))
			return "";

		SimpleDateFormat formatter = new SimpleDateFormat(format, loc);
		return formatter.format(new Date());
	}
	// 지정 format으로 Date를 String 변환
	public static String getDate(Date dt, String format, Locale loc) {
		String timeZone = "KST";
		return getDate(dt, format, loc, timeZone);
	}
	public static String getDate(Date dt, String format, Locale loc, String timeZone) {
		if (format == null || format.equals(""))
			return "";

		SimpleDateFormat formatter = new SimpleDateFormat(format, loc);
		//formatter.setTimeZone(TimeZone.getTimeZone(timeZone));
		return formatter.format(dt);
	}
    
    // TODO::XML에 의한 Pattern 변수를 정의하는 경우 정의된 변수를 확인하기 위해 준비 중인 함수
    public String getFuncName(String fn) {
	String res = getFuncVar(fn); // res="#{RAND_NUM(3, 255)}"
	
	int stidx = fn.indexOf("#{");
	if ( stidx < 0 ) return res;
	
	int edidx = fn.indexOf("}");
	if ( edidx < 0 ) return res;
	
	if ( stidx >= edidx ) return res;
	res = fn.substring(stidx+2, edidx);
	//System.out.println("getFuncName[stidx:"+stidx + ", edidx:" + edidx+"] [" + fn + "] ==> " + res);
	return res;
    }
    // TODO::XML에 의한 Pattern 변수를 정의하는 경우 값을 대체하기 위해 준비 중인 함수
    public String getFuncVar(String fn) {
	String res = "";
	
	int stidx = fn.indexOf("#{");
	if ( stidx < 0 ) return res;
	
	int edidx = fn.indexOf("}");
	if ( edidx < 0 ) return res;
	
	if ( stidx >= edidx ) return res;
	
	res = fn.substring(stidx, edidx+1);
	//System.out.println("getFuncVar[stidx:"+stidx + ", edidx:" + edidx+"] [" + fn + "] ==> " + res);
	return res;
    }
    
    // WAS_ERROR, WAS_FAILURE의 error_message 임시처리
    public String randErrorMessage(String cmd, int num) {
    	String res = "";
    	
    	if ((cmd + num).equals("error1")) {
    		res = "for host " + randNumStr(0, 255) + "." + randNumStr(0, 255) + "." + randNumStr(0, 255) + "." + randNumStr(0, 255) + " trying to POST /RDServer/rdagent.jsp, wl-proxy reports: exception occurred for backend host '" + randNumStr(0, 255) + "." + randNumStr(0, 255) + "." + randNumStr(0, 255) + "." + randNumStr(0, 255) + "/" + randNum(9999) + "/0': 'FAILOVER_REQUIRED [line " + randNum(9999) + " of proxy.cpp]: Service Unavailable'";
    	} else if ((cmd + num).equals("error2")) {
    		res = "HTTP3068: Error receiving request from " + randNumStr(0, 255) + "." + randNumStr(0, 255) + "." + randNumStr(0, 255) + "." + randNumStr(0, 255) + " (Connection refused)";
    	} else if ((cmd + num).equals("failure1")) {
    		res = "for host " + randNumStr(0, 255) + "." + randNumStr(0, 255) + "." + randNumStr(0, 255) + "." + randNumStr(0, 255) + " trying to POST /subjectSearchAction.do, wl-proxy reports: IO error reading POST data at line " + randNum(9999) + " of proxy.cpp, system error: 'Connection reset by peer'";
    	} else if ((cmd + num).equals("failure2")) {
    		res = "for host " + randNumStr(0, 255) + "." + randNumStr(0, 255) + "." + randNumStr(0, 255) + "." + randNumStr(0, 255) + " trying to POST /subjectSearchAction.do, wl-proxy reports: IO error reading GET";
    	} else if ((cmd + num).equals("failure3")) {
    		res = "for host " + randNumStr(0, 255) + "." + randNumStr(0, 255) + "." + randNumStr(0, 255) + "." + randNumStr(0, 255) + " trying to POST /subjectSearchAction.do, wl-proxy reports: exception occurred: 'READ_ERROR_FROM_CLIENT [os error=" + randNum(999) + ", line " + randNum(999) + " of proxy.cpp]: reading client POST data failed'";
    	}
    	
    	return res;
    }
    
    // 배열 문자열에서 랜덤으로 선택
    public String randCodeStr(String[] arrList) {
	String res = "";
	
	int max = arrList.length;
	int n = randNum(max);
	//System.out.println("randNum[max:" + max+"] " + n);
	//res += String.valueOf(n);
	res = arrList[n-1];
	//System.out.println("randCodeStr[max:" + max+"] " + res);
	return res;
    }
    
    // 다중 배열 문자열에서 0 index인 key를 랜덤으로 선택
    public String randCodeStr(String[][] arrList) {
	return randCodeStr(arrList, 0);
    }
    
    // 다중 배열 문자열에서 pos index 값을 랜덤으로 선택
    public String randCodeStr(String[][] arrList, int pos) {
	String res = "";
	
	int max = arrList.length;
	int n = randNum(max);
	//System.out.println("randNum[max:" + max+"] " + n);
	//res += String.valueOf(n);
	res = arrList[n-1][pos];
	//System.out.println("randCodeStr[max:" + max+"] " + res);
	return res;
    }
    
    // 1~max 까지의 정수를 랜덤하게 출력
    public int randNum(int max) {
	Random oRandom = new Random();
	int i = oRandom.nextInt(max) + 1;
	//System.out.println("randNum[max:" + max+"] " + i);
	return i;
    }
    
    // 1~max 까지의 pos 자리수의 정수를 랜덤하게 출력, 빈자리수는 '0'로 채움
    public String randNumStr(int pos, int max) {
	String res = "";
	int n = randNum(max);
	//System.out.println("randNum[max:" + max+"] " + n);
	if (pos != 0) {
//	    for (int i = 1; i < pos; i++) {
//		if ( n < Math.pow(10, i) ) res += "0";
//	    }
	    String formstr = "%0"+pos+"d";
	    //System.out.println("formstr="+formstr);
	    res = String.format(formstr, n);
	}
	else res += String.valueOf(n);
	//System.out.println("randNumStr[pos:"+pos + ", max:" + max+"] " + res);
	return res;
    }
    
    // 소문자 a-z 랜덤 알파벳을 이용한 len 자리수 문자열 생성
    public static String randStr(int len) {
	String res = randLowerStr(len);
	//System.out.println("randStr[len:"+len+"] " + res);
	return res;
    }
    
    // 소문자 a-z 랜덤 알파벳을 이용한 len 자리수 문자열 생성
    public static String randLowerStr(int len) {
	String res = "";
	for (int i = 1; i <= len; i++) {
	    char ch = randLowerChar();
	    res += (ch + "");
	}
	//System.out.println("randLowerStr[len:"+len+"] " + res);
	return res;
    }
    // 대문자 A-Z 랜덤 알파벳을 이용한 len 자리수 문자열 생성
    public static String randUpperStr(int len) {
	String res = "";
	for (int i = 1; i <= len; i++) {
	    char ch = randUpperChar();
	    res += (ch + "");
	}
	//System.out.println("randUpperStr[len:"+len+"] " + res);
	return res;
    }

    // 소문자 a-z 랜덤 알파벳 생성
    private static char randLowerChar() {
	return (char) ((Math.random() * 26) + 97);
    }
    // 대문자 A-Z 랜덤 알파벳 생성
    private static char randUpperChar() {
	return (char) ((Math.random() * 26) + 65);
    }
}
